﻿using ImageMagick;

namespace PmSoft.Utilities
{
    public class ImageUtility
    {
        /// <summary>
        /// 压缩照片
        /// </summary>
        /// <param name="inData"></param>
        /// <returns></returns>
        public static byte[] CompressPhoto(byte[] inData)
        {
            using (MemoryStream memStream = new MemoryStream())
            {
                using (MagickImage image = new MagickImage(inData))
                {
                    image.Format = MagickFormat.Png;
                    image.Quality = 10;
                    image.Write(memStream);
                }
                var data = memStream.ToArray();
                return data;
            }
        }
    }
}
